﻿id_northeast_obsession = {
	icon = "gfx/interface/icons/event_icons/event_scales.dds"

	on_monthly_pulse = {
		effect = {
			if = {
				limit = {
					country_has_primary_culture = cu:han
				
				
	
		c:HHW = {
		OR = {
		ROOT = c:HHW
		army_size < root.army_size
		}
		}
		c:HJL = {
		OR = {
		ROOT = c:HJL
		army_size < root.army_size
		}
		}
				c:HHL = {
		OR = {
		ROOT = c:HHL
		army_size < root.army_size
		}
		}
				c:HSY = {
		OR = {
		ROOT = c:HSY
		army_size < root.army_size
		}
		}
					
				
						
						
						
						
					
				}
				change_variable = {
					name = id_northeast_completion
					add = 1
				}
			}
		}
	}

	complete = {
	
	capital = {
				any_scope_building = {
				is_building_type = building_university
				level >= 5
			}
				any_scope_building = {
				is_building_type = building_government_administration
				level >= 10
			}
				any_scope_building = {
				is_building_type = building_arms_industry
				level >= 2
			}
				any_scope_building = {
				is_building_type = building_steel_mills
				level >= 2
			}
			
			
			
	
	}
		scope:journal_entry = { is_goal_complete = yes }
					country_has_primary_culture = cu:han
		c:HHW = {
		OR = {
		ROOT = c:HHW
		army_size < root.army_size
		}
		}
		c:HJL = {
		OR = {
		ROOT = c:HJL
		army_size < root.army_size
		}
		}
				c:HHL = {
		OR = {
		ROOT = c:HHL
		army_size < root.army_size
		}
		}
				c:HSY = {
		OR = {
		ROOT = c:HSY
		army_size < root.army_size
		}
		}
	}

	on_complete = {
				custom_tooltip = je_id_dongbei_tooltip_tt
		if ={
		limit = {
		exists = c:HHL
		NOT = {this = c:HHL}
		}
		annex = c:HHL
		}
				if ={
		limit = {
		exists = c:HJL
		NOT = {this = c:HJL}
		}
		annex = c:HJL
		}
				if ={
		limit = {
		exists = c:HSY
		NOT = {this = c:HSY}
		}
		annex = c:HSY
		}
				if ={
		limit = {
		exists = c:HHW
		NOT = {this = c:HHW}
		}
		annex = c:HHW
		}
							every_scope_state = {
				set_state_type = incorporated
			}
	}

	fail = {
		NOT = { exists = c:HHW}
		NOT = { exists = c:HHL}
		NOT = { exists = c:HJL}
		NOT = { exists = c:HSY}
	}

	on_fail = {
	}

	current_value = {
		value = root.var:id_northeast_completion
	}

	goal_add_value = {
		add = 120
	}

	progressbar = yes

	weight = 10000
	should_be_pinned_by_default = yes
}

id_opium_wars = {
	icon = "gfx/interface/icons/event_icons/event_military.dds"

	complete = {
	is_player = yes
	 year > 1840
	 exists = c:ZHI
	 this = c:ZHI
	 		has_technology_researched =	central_archives
		has_technology_researched =	law_enforcement
	overlord = {
				any_primary_culture = {
					has_cultural_obsession = opium
				}
		}
	}

	on_complete = {

			set_variable = {
			name = id_mod_zhili_gov
		}
					create_character = {
				first_name = Zexu
				last_name = Lin
				culture = cu:han
				ruler = yes
				birth_date = 1785.8.30
							interest_group = ig_devout
			ideology = ideology_traditionalist
				traits = {
				brave
				cautious
				charismatic
				}
			}
			
		create_character = {
			# W-G: Kung Tzu-chen, courtesy name Seren
			first_name = Zizhen
			last_name = Gong
			birth_date = 1792.8.22
			culture = cu:han
			ig_leader = yes
			interest_group = ig_trade_unions
			ideology = ideology_traditionalist
			traits = {
				reckless
				pious
			}
		}

		create_character = {
			# courtesy name Ougen
			first_name = Changling
			last_name = He
			birth_date = 1785.3.18
			culture = cu:han
			ig_leader = yes
			interest_group = ig_intelligentsia
			ideology = ideology_moderate
			traits = {
				meticulous
			}
		}

		create_character = {
			first_name = Yuan
			last_name = Ruan
			age = 72 # exact birthday unclear
			culture = cu:han
			ig_leader = yes
			interest_group = ig_industrialists
			ideology = ideology_moderate
			traits = {
				meticulous
			}
		}

		create_character = {
			first_name = Lexing
			last_name = Zhang
			age = 24 # exact birthday unknown
			culture = cu:han
			ig_leader = yes
			interest_group = ig_rural_folk
			ideology = ideology_traditionalist
			traits = {
				ambitious
				firebrand
				bandit
			}
		}

		create_character = {
			first_name = Yupian
			last_name = Huang
			age = 52 # age unknown, arbitrarily picking an age instead
			culture = cu:han
			ig_leader = yes
			interest_group = ig_petty_bourgeoisie
			ideology = ideology_royalist
			traits = {
				persistent
				pious
			}
		}

		create_character = {
			is_admiral = yes
			first_name = Tianpei
			last_name = Guan
			age = 55
			culture = cu:han
			traits = {
				expert_naval_commander
				brave
			}
		}


		create_character = {
			is_admiral = yes
			first_name = Huacheng
			last_name = Chen
			age = 60
			culture = cu:han
			traits = {
				experienced_naval_commander
				ambitious
			}
		}

		create_character = {
			is_general = yes
			first_name = Fang
			last_name = Yang
			age = 66
			culture = cu:han
			hq = region_north_china
			commander_rank = commander_rank_4
			traits = {
				persistent
				cautious
			}
		}
		
		create_character = { # CHI, general
			is_general = yes
			first_name = Bingzhang
			last_name = Luo
			culture = cu:han
			interest_group = ig_landowners
			ideology = ideology_reformer
			birth_date = 1793.1.9
			hq = region_south_china
			commander_rank = commander_rank_5
			traits = {
				stalwart_defender
				wrathful
			}
		}
				create_character = { # CHI, general
			is_general = yes
			first_name = Delu
			last_name = Wang
			culture = cu:han
			interest_group = ig_landowners
			ideology = ideology_royalist
			birth_date = 1772.6.1 # exact date unknown
			hq = region_south_china
			commander_rank = commander_rank_3
			traits = {
				experienced_offensive_planner
				experienced_colonial_administrator
				meticulous
			}
		}
		create_character = { # CHI, general
			is_general = yes
			first_name = Yunfei
			last_name = Ge_2
			culture = cu:han
			interest_group = ig_armed_forces
			ideology = ideology_royalist
			birth_date = 1789.6.6 # exact date unknown
			hq = region_south_china
			commander_rank = commander_rank_2
			traits = {
				brave
				stalwart_defender
			}
		}
	add_journal_entry = { type = id_zhi_warlord_china }

				custom_tooltip = je_id_military_china_tooltip_tt
						custom_tooltip = je_id_zhili_gov_tooltip_tt
		hidden_effect = {
		c:MCH = {
				create_diplomatic_pact = {
			country = ROOT
			type = id_zongdu
		}	
		}
		}
		c:MCH = {
		every_subject_or_below = {
		limit = {
								NOR = {
					this = c:HHL
					this = c:HHW
					this = c:HSY
					this = c:HJL
				}
						OR = {
								has_diplomatic_pact = { who = c:MCH type = id_buzhengshi }
				has_diplomatic_pact = { who = c:MCH type = id_zongdu } 
				has_diplomatic_pact = { who = c:MCH type = id_dujun }
				
				}
		}
		ROOT = {
			annex = PREV
		}
		}
		
		
		
		}
	}

	fail = {
	OR = {
		NOT = { exists = c:ZHI }
	 NOT = {this = c:ZHI }
	 AND = {
		exists = overlord
		overlord = {
			NOT = {
				any_primary_culture = {
					has_cultural_obsession = opium
				}
			}
		}
		}
	}
	}

	on_fail = {
	}


	weight = 10000
	should_be_pinned_by_default = yes
}

id_zhi_warlord_china = {
	icon = "gfx/interface/icons/event_icons/event_fire.dds"


	complete = {

		NOT = {has_modifier = id_linguistic_keju}
		has_technology_researched = nationalism
	}

	fail = {
		is_subject = no
		
	}
	on_fail = {
			trigger_event = { id = warlord_china_events.100 }
			remove_variable = id_mod_zhili_gov
			remove_modifier = id_nation_zhixiaqu
	}

	on_complete = {
			add_modifier = {
				name = id_nation_zhengyi
				months = 120
			}
			custom_tooltip = je_id_dongbei_tooltip_tt
			hidden_effect = {
					c:MCH = {
		every_subject_or_below = {
		limit = {
						OR = {
					this = c:HHL
					this = c:HHW
					this = c:HSY
					this = c:HJL
					this = c:HYL
				}
		}
		ROOT = {
			annex = PREV
		}
		}
		}
		}
			remove_variable = id_mod_zhili_gov
						add_modifier = id_nation_shouyi	
			custom_tooltip = je_id_unify_china_tooltip_tt
		c:MCH = {
		every_subject_or_below = {
		limit = {
						OR = {
				has_diplomatic_pact = { who = c:MCH type = vassal }
				has_diplomatic_pact = { who = c:MCH type = id_buzhengshi }
				has_diplomatic_pact = { who = c:MCH type = id_zongdu } 
				has_diplomatic_pact = { who = c:MCH type = id_dujun }
				}
		}
		ROOT = {
				create_diplomatic_pact = {
			country = PREV
			type = vassal
		}	
		}
		}
		
		}
	}


	weight = 10000
	should_be_pinned_by_default = yes
}
